html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-size: 16px;
}

#downloader {
  /* display: none; causes child a.click() not work in Firefox */
  visibility: hidden;
  position: absolute;
  border: none;
  width: 0;
  height: 0;
}

#wrapper {
  display: flex;
  flex-flow: column;
  height: 100%;
}

/* toolbar */
#toolbar {
  flex: 0 1 auto;
  border-bottom: 2px ridge #CCCCCC;
}

#toolbar select {
  margin: 3px;
}

#book {
  float: __MSG_@@bidi_start_edge__;
  max-width: 10em;
}

#toolbar > div {
  float: __MSG_@@bidi_end_edge__;
}

#toolbar button {
  margin: 2px;
  border: none;
  padding: 0;
  width: 24px;
  height: 24px;
  background: none;
  font-size: 24px;
  line-height: 1;
}

#toolbar select:disabled,
#toolbar button:disabled {
  filter: grayscale(100%);
  opacity: 0.3;
}

#toolbar button:hover {
  background-color: rgba(202, 202, 202, 0.8);
}

#command-popup,
#command-popup-book {
  position: absolute;
  z-index: 20000;
  overflow: auto;
  box-sizing: border-box;
  list-style: none;
  margin: 0;
  outline: none;
  border: 1px solid #999;
  border-radius: 2px;
  box-shadow: 0 0 4px 1px rgba(0, 0, 0, 0.3);
  padding: 1px;
  background: white;
}

#command-popup button,
#command-popup-book button {
  display: block;
  outline: none;
  border: none;
  background: none;
  padding: 1px 3px;
  width: 100%;
  font-size: 0.833em;
  text-align: __MSG_@@bidi_start_edge__;
  white-space: nowrap;
}

#command-popup button:disabled,
#command-popup-book button:disabled {
  filter: grayscale(100%);
  opacity: 0.3;
}

#command-popup button:enabled:focus,
#command-popup-book button:enabled:focus {
  outline: 1px solid rgba(125, 162, 206, 0.8);
  background: linear-gradient(rgba(235, 244, 253, 0.3), rgba(196, 221, 252, 0.8));
}

#command-popup button:enabled:hover,
#command-popup-book button:enabled:hover {
  background-color: rgba(202, 202, 202, 0.8);
}

#command-popup button:enabled:active,
#command-popup-book button:enabled:active {
  background-image: radial-gradient(rgba(0, 0, 0, 0.9), rgba(64, 64, 64, 0.9));
  color: #FFFFFF;
}

#command-popup button[hidden],
#command-popup-book button[hidden] {
  display: none;
}

/* logger */
#logger {
  flex: 0 1 auto;
  max-height: 200px;
  overflow: auto;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  margin: 0;
  padding: 3px;
  font-size: 0.75em;
  font-family: unset;
}

#logger .warn {
  color: #f0ad4e;
  font-weight: bold;
}

#logger .error {
  color: #d9534f;
  font-weight: bold;
}

/* dialog*/
#dialog-mask {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.1);
}

#dialog-wrapper {
  position: fixed;
  top: 5%;
  bottom: unset;
  left: 0;
  right: 0;
  margin: auto;
  border: solid;
  width: 90%;
  max-height: 90%;
  padding: 12px;
  box-sizing: border-box;
  background-color: #fcfcfc;
  overflow: auto;
  font-size: 0.75em;
}

#dialog-wrapper dl {
  box-sizing: border-box;
  margin: 0;
  width: 100%;
}

#dialog-wrapper dl > div > dt {
  margin: 3px;
  font-weight: bold;
}

#dialog-wrapper dl > div > dd {
  margin: 3px;
}

#dialog-wrapper label {
  white-space: nowrap;
}

#dialog-wrapper input[type="text"],
#dialog-wrapper input[type="number"],
#dialog-wrapper textarea {
  box-sizing: border-box;
  width: 100%;
}

#dialog-wrapper input[type="text"][readonly] {
  background-color: #DDD;
}

#dialog-wrapper .buttons {
  float: __MSG_@@bidi_end_edge__;
  margin-top: 1em;
  padding: 3px;
}

#dialog-wrapper form.meta [name="comment"] {
  height: 20vh;
  min-height: 80px;
}

#dialog-wrapper form.meta [name="location"]  {
  width: calc(100% - 2.5em - 2px);
}

#dialog-wrapper form.meta [name="location-view"],
#dialog-wrapper form.meta [name="location-reset"] {
  margin: 0 .125em;
  padding: 0;
  border: 0;
  width: 1em;
  height: 1em;
  font-size: 1em;
}

#dialog-wrapper form.meta dl > div {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-content: stretch;
}

#dialog-wrapper form.meta dl > div[hidden] {
  display: none;
}

#dialog-wrapper form.meta dl > div > dt {
  flex: 1 0 6em;
}

#dialog-wrapper form.meta dl > div > dd {
  flex: 999 1 14em;
}

#dialog-wrapper form.meta dl > div > dd.short {
  flex: 999 1 2em;
}

/* tree */
#tree {
  flex: 1 1 auto;
  overflow: auto;
  font-size: 0.875em;
}

#postit-resizer {
  flex: 0 0 40%;
  display: flex;
  resize: vertical;
  overflow: hidden;
  min-height: 40px;
  max-height: 80%;
}

#postit-resizer[hidden] {
  display: none;
}

#postit {
  display: block;
  box-sizing: border-box;
  width: 100%;
}

#postit[hidden] {
  display: none;
}
